using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ModelFlyweightTest_1 : MonoBehaviour
{
    public GameObject modelPrefab;
    // Start is called before the first frame update
    void Start()
    {
        //创建享元工厂
        ModelFlyweightFactory_1 factory = new ModelFlyweightFactory_1();

        //获取享元对象
        ModelFlyweight_1 flyweight1 = factory.GetFlyweight("SharedModel", modelPrefab);
        //在不同位置渲染模型
        for (int i = 0; i < 5; i++)
        {
            Vector3 position = new Vector3(i * 2.0f, 0, 0);
            flyweight1.Render(position);
        }

    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
